import {defineStore} from "pinia";

export const useStore = defineStore("store", {
    unistorage: true, // 是否持久化
    state: () => ({
        hasLogin: false,        // 判断是否登录
        token: '',              // 用户登录的token
        userId: '',           // 用户编号
        userType: '',           // 用户名
        userName: '',           // 用户名
        avatarUrl: '',          // 用户头像
        phone: '',              // 用户手机号码
        auditStatus: '0',  // 是否认证
        adminLevel: '0',  // 是否认证
        adminLevelName: '',  // 是否认证
        qrcode: 'fh',  // 是否认证
        promoCode: 'fh' , // 是否认证
        promoCodeUrl: 'fh' , // 是否认证
        upgradePreLevel: 0,
        upgradeLevel: 0,
        upgradeTime: '',
        city: '',
        ownerShop: {
            poiId: '',
            poiName: '',
            address:'',
            cardType:'',
            cardStartTime:'',
            cardEndTime:'',
            corporation: '',
            corporationPhone: '',
            storePhone: '',
            businessLicense: '',
            sanitaryLicensePhoto: '',
            sanitaryLicensePhotos: [],
            dredgeDouyin: '',
            dredgeBuy: '',
            businessLicensePhoto: '',
            businessLicensePhotos: [],
            corporationPhoto: '',
            corporationPhotos: [],
            corporationCard: '',
            corporationCardBank: '',
            doorPhoto: '',
            doorPhotos: [],
            evnPhoto: '',
            evnPhotos: [],
            douyinPhoto: '',
            douyinPhotos: [],
            deliveryAddress: '',
            businessHour: ''
        }
    }),
    getters: {
    },
    actions: {
        loginIn: (state, token,userId, userName, avatarUrl) => {
            state.hasLogin = true;
            state.token = token;
            state.userId = userId;
            state.userName = userName;
            state.avatarUrl = avatarUrl;
        }
    }
})
